﻿@model Model.AppUserList
@{
    ViewBag.Title = "DCInventory";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@using Model

@section JQscriptSection{
    <script type="text/javascript">
        $(document).ready(function () {
            InitGrid();

        });

        HandleDom.ClassTriggerClick("icon-reload", function () {
            InitGrid();
        });
        HandleDom.ClassTriggerClick("icon-upload", function () {
            upload();
        });



        function InitGrid() {
            var sWarehHuseId = $('#sWarehHuseId').combobox('getValue');
            var txtGoodsCodee = $('#txtGoodsCode').val();
            var txtGoodsName = $('#txtGoodsName').val();
            var txtGoodsBatchNo = $('#txtGoodsBatchNo').val();
            var txtStatus = $('#status').combobox('getValue');


            queryParams = {
                sWarehHuseId: sWarehHuseId,
                goodsCode: txtGoodsCodee,
                goodsName: txtGoodsName,
                goodsBatchNo: txtGoodsBatchNo,
                status: txtStatus
            }
            HandleData.InitDataGrid('dg', '/DCInventory/InitJsonResult', 'toolbar', queryParams, 'WAREHOUSEID', true, function (data) { },
                function (rowIndex, rowData) {//双击
                    edit(rowData);
                });
        }
        function upload() {
            var form = $('#query');
            var goodsCode = $("#txtGoodsCode").val();
            form.form('submit', {
                url: '@Url.Content("~/DCInventory/UploadInventory")' + "?goodsCode=" + goodsCode,
                success: function (data) {
                    eval('data=' + data);
                    if (data.success) {
                        layer.msg(data.msg, 1);
                        InitGrid();
                    }
                    else {
                        layer.alert(data.msg, 9);
                    }
                }
            });
        }
    </script>
}

<body style="background-color: ButtonFace; font-size: 17px">
    <div class="easyui-panel" title="查询条件" style="height: 130px; padding: 5px; background: #fafafa; width: 1700px;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>仓库编号:
                    </td>
                    <td>
                        <input id="sWarehHuseId" class="easyui-combobox" name="sWarehHuseId" style="width: 155px;" data-options="required:true,valueField:'WAREHOUSEID',textField:'WAREHOUSENAME',url:'@Url.Action("GetDCWarehouseList", "DCWarehouse", new { isDefault = true, defaultValue = "请选择仓库" })',editable:false">
                    </td>

                    <td>商品编码:
                    </td>
                    <td>
                        <input id="txtGoodsCode" name="txtGoodsCode" style="width: 154px" />
                    </td>
                    <td>商品名称:
                    </td>
                    <td>
                        <input id="txtGoodsName" name="txtGoodsName" style="width: 154px" />
                    </td>
                    <td>入库批次号:
                    </td>
                    <td>
                        <input id="txtGoodsBatchNo" name="txtGoodsBatchNo" style="width: 154px" />
                    </td>
                    <td>状态:
                    </td>
                    <td>
                        <select id="status" class="easyui-combobox" name="status" style="width: 154px;">
                            <option value="">--全部--</option>
                            <option value="0">失效</option>
                            <option value="1">生效</option>
                        </select>
                    </td>
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGrid()">查询</a>
                    </td>
                </tr>


            </table>
        </form>
    </div>
    <div style="min-height: 720px; width: 1700px;">
        <table id="dg" title="库存信息" style="min-height: 600px;">
            <thead>
                <tr>
                    <th data-options="field:'WAREHOUSENAME',width:50">仓库名称</th>
                    <th data-options="field:'GOODSCODE',width:50">商品编码</th>
                    <th data-options="field:'GOODSNAME',width:80">商品名称</th>
                    <th data-options="field:'GOODSBATCHCODE',width:60">入库批次</th>
                    <th data-options="field:'PRODUCTIONDATE',width:120">生产日期</th>
                    <th data-options="field:'EXPIRYDAYS',width:50">保质期</th>
                    <th data-options="field:'USEFULQTY',width:60">可用库存</th>
                    <th data-options="field:'ACTUALQTY',width:60">实际库存</th>
                    <th data-options="field:'STATUS',width:30,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatValid(value);}">状态</th>
                    <th data-options="field:'OPRNO',width:50">创建人</th>
                    <th data-options="field:'CREATEDATE',width:100,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatDate(value);}">创建时间</th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="dlg" class="easyui-dialog" style="width: 620px; height: 250px; top: 300px; left: 400px; padding: 2px"
        data-options="closed:true,buttons:'#dlg-buttons',modal:true">
        <form id="location" method="post">
            <table>
                <tr>
                    <td>仓库编码:
                    </td>
                    <td>
                        <input id="hiddenWAREHOUSEID" name="hiddenWAREHOUSEID" type="hidden" />
                        <input id="hiddenWAREHOUSECODE" name="hiddenWAREHOUSECODE" type="hidden" />
                        <input id="stxtWarehouseCode" name="stxtWarehouseCode" maxlength="20" style="width: 154px" class="easyui-validatebox" data-options="required:true" />
                    </td>
                    <td>仓库名称:
                    </td>
                    <td>
                        <input id="stxtWarehouseName" name="stxtWarehouseName" maxlength="20" style="width: 154px" class="easyui-validatebox" data-options="required:true" />
                    </td>
                </tr>
                <tr>
                    <td>状态:
                    </td>
                    <td>
                        <select id="sstatus" class="easyui-combobox" name="sstatus" style="width: 154px;">
                            <option value="0">失效</option>
                            <option value="1">生效</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>地址:
                    </td>
                    <td colspan="2">
                        <input id="txtADDRESS" name="txtADDRESS" style="width: 354px" />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <a id="btnSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="saveData(false)">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    @Html.Partial("~/Views/Shared/_PartialToolbar.cshtml", new Toolbar
{
    GridName = "dg",
    GridType = "datagrid",
    ToolbarName = "toolbar",
    FunctionModule = new Dictionary<string, List<FunctionModule>>()
    {
        {"Function",new List<FunctionModule>()
            {
              new FunctionModule(){Name = "Add",IsEnable =false },
              new FunctionModule(){Name = "Edit",IsEnable =false },
              new FunctionModule(){Name = "Remove",IsEnable =false },
              new FunctionModule(){Name = "Reload",IsEnable =true },
              new FunctionModule(){Name = "Collapse",IsEnable =false },
              new FunctionModule(){Name = "Exporter",IsEnable =false },
              new FunctionModule(){Name = "Upload",IsEnable =true },


            }
        }
    }
})

</body>

